from command import Command

__all__ = [
    "TV", "TVOnCommand", "TVOffCommand"
]

class TV:
    def __init__(self, location: str):
        self._location = location
        self._on = False
        self._channel = 0

    def on(self):
        self._on = True
        print(f"{self._location} TV is on")

    def off(self):
        self._on = False
        print(f"{self._location} TV is off")

    def set_input_channel(self):
        self._channel = 3
        print(f"{self._location} TV channel is set for DVD")


class TVOnCommand(Command):
    def __init__(self, tv: TV):
        self._tv = tv

    def execute(self):
        self._tv.on()
        self._tv.set_input_channel()

    def undo(self):
        self._tv.off()


class TVOffCommand(Command):
    def __init__(self, tv: TV):
        self._tv = tv

    def execute(self):
        self._tv.off()

    def undo(self):
        self._tv.on()
